package com.freesky.provider.content.controller;

import com.freesky.common.enums.PanelPositionEnum;
import com.freesky.common.pojo.ZTreeNode;
import com.freesky.common.utils.reponse.JSONResponse;
import com.freesky.common.dao.entity.Panel;
import com.freesky.provider.content.service.IHomePanelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: 陈玉林
 * @modifiedBy:
 * @date: Create In 17:51 2018/12/12
 * @description:
 */
@RestController
public class HomePanelController {
    @Autowired
    private IHomePanelService homePanelService;

    @PostMapping(value = "/home/panel/add")
    public JSONResponse add(@RequestBody Panel panel){
        return homePanelService.add(panel);
    }

    @GetMapping(value = "/home/panel/list")
    public List<ZTreeNode> list(){
        return homePanelService.list();
    }

    @PostMapping(value = "/home/panel/update")
    public JSONResponse updateContentCategory(@RequestBody Panel panel){
        return homePanelService.update(panel);
    }

    @DeleteMapping(value ="/home/panel/del/{id}")
    public JSONResponse delete(@PathVariable("id") int id){
        return homePanelService.delete(id);
    }


    /**
     * 前台获取商品推荐模块
     * @return
     */
    @GetMapping(value = "/home/panel/portal/recommend")
    public JSONResponse getRecommendPanel() {
        return homePanelService.getRecommendPanel();
    }
    /**
     * 前台获取捐赠模块
     * @return
     */
    @GetMapping(value = "/home/panel/portal/thanks")
    public JSONResponse getThanksPanel() {
        return homePanelService.getThanksPanel();
    }
}
